﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ETA.Entity;
using FluentNHibernate.Mapping;

namespace ETA.EntityMappings
{
    public class RegistrationMainFormMap : ClassMap<RegistrationMainForm>
    {
        public RegistrationMainFormMap()
        {
            Id(x => x.RegistrationMainFormId);
            Map(x => x.IsDelete);
            Map(x => x.ModifyDate);
            Map(x => x.CreateDate);
            References(x => x.User).Column("UserId");
            References(x => x.CurrentStep).Column("FlowStepId");
            //HasOne<User>(x => x.User).ForeignKey("UserId");
            //HasOne<RegistrationBasicInfo>(x => x.RegistrationBasicInfo).ForeignKey("RegistrationBasicInfoId").LazyLoad();
            HasMany<FlowLog>(x => x.FlowLogs).KeyColumn("RegistrationMainFormId").Where(t => t.IsDelete == false).Not.LazyLoad();
            HasMany<RegistrationBasicInfo>(x => x.RegistrationBasicInfos).KeyColumn("RegistrationMainFormId").Where(t => t.IsDelete == false).LazyLoad();
            HasMany<RegistrationEducation>(x => x.RegistrationEducations).KeyColumn("RegistrationMainFormId").Where(t => t.IsDelete == false).LazyLoad();
            HasMany<RegistrationJob>(x => x.RegistrationJobs).KeyColumn("RegistrationMainFormId").Where(t => t.IsDelete == false).LazyLoad();
            HasMany<RegistrationFamilay>(x => x.RegistrationFamilays).KeyColumn("RegistrationMainFormId").Where(t => t.IsDelete == false).LazyLoad();
        }
    }
}
